// NetworkService.kt
package com.srtp.secureprotocol

import android.app.Service
import android.content.Intent
import android.os.IBinder
import android.util.Log

class NetworkService : Service() {
    private val TAG = "NetworkService"
    private lateinit var httpServer: SecureProtocolHttpServer

    override fun onCreate() {
        super.onCreate()
        Log.d(TAG, "onCreate")
        httpServer = SecureProtocolHttpServer(applicationContext, 8088)
        httpServer.start()
    }

    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
        Log.d(TAG, "Service started")
        return START_STICKY
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d(TAG, "onDestroy")
        httpServer.stop()
    }

    override fun onBind(intent: Intent?): IBinder? = null
}